Skip to main content

Actions Overview in LiveCode Create

Adding logic to your app in LiveCode Create is simple and flexible. Whether you are a beginner or an advanced user, LiveCode Create provides two powerful ways to add app behavior:

  1. Actions: A visual, no-code approach to building workflows.
  2. Script: Write custom code using LiveCode’s easy-to-learn scripting language.

This guide provides an overview of Actions, how they work, and how you can combine them with scripting to build advanced app logic.


What are Actions?

Actions are pre-built tasks you can visually drag and connect in the Workflow Editor to define how your app responds to user interactions or events.

With Actions, you can:

  • Create records in a collection.
  • Show or hide widgets.
  • Navigate between layouts.
  • Trigger notifications, send emails, or integrate external services.

Accessing Actions

To add Actions to an object:

  1. Select a Widget by clicking on it in the Canvas Area or Project Browser.
  2. Right click on it to open its dropdown menu and select Edit Actions.
  3. Click the New Workflow button in the top right of the Actions page

The Workflow Editor

The Workflow Editor is the visual environment where you build workflows using Action Blocks. By linking these blocks you can create a string of actions that occur after the user performs a certain trigger.

Key Components of the Workflow Editor

  • Triggers: Define the event that starts the workflow (e.g., Button Click).
  • Action Blocks: Drag pre-built Actions into the Workflow Canvas.
  • Connections: Connect Action Blocks to define the order of tasks.
  • Script View: View the automatically generated LiveCode script at any time.

Adding Actions to a Workflow

Follow these steps to create a workflow using Actions:

1. Choose a Trigger

Triggers determine when the workflow starts. Examples include:

  • Click: When a button is clicked.
  • Text Changed: When a text field value changes.

2. Drag Action Blocks

  1. Open the Workflow Editor.
  2. Drag Action Blocks onto the Canvas. Common Actions include:
    • Navigate to Layout: Switch to another screen.
    • Show/Hide Object: Make objects visible or invisible.
    • Create Record: Add data to a Collection.
    • Show Message Dialog: Show messages to users.

Workflow Example

3. Connect Action Blocks

Connect Action Blocks to define the flow of logic. Use drag-and-drop connectors to link one block to another.

4. Test Your Workflow

Switch to Run Mode and test your workflow. Make sure it behaves as expected.


Viewing Script for Actions

Every Action you create automatically generates LiveCode script behind the scenes. You can:

  1. Expand Action Blocks: View the code generated for each block.
  2. Switch to Script Mode: In the Workflow Editor, toggle to Script Mode to see the full generated script.
  3. Open the Script Editor: Right-click on the widget and select Edit Script to view the script directly in the Script Editor.

Combining Actions with Custom Script

LiveCode Create allows you to combine visual Actions with custom scripting seamlessly.

Using Raw LiveCode Script Blocks

In the Workflow Editor, you can add a Raw LiveCode Script Block to write custom code within your workflow.

Steps:

  1. Drag a Raw LiveCode Script Block onto the Canvas.
  2. Write your custom code inside the block.
Custom Script Block
on mouseUp  
answer "Button Clicked!"
end mouseUp

This flexibility allows advanced users to extend workflows and add custom functionality that may not be available with pre-built Actions.


When to Use Actions vs. Script

ScenarioSolution
Build logic quickly and visuallyUse Actions
Customize specific behaviorUse Raw LiveCode Script Blocks in workflows
Advanced app logic or performance needsUse the Script Editor

Benefits of LiveCode’s Dual Approach

LiveCode Create’s combination of Actions and Script offers the best of both worlds:

  • No-Code for Simplicity: Quickly build workflows visually.
  • Low-Code for Flexibility: Add custom behavior using LiveCode Script.
  • Gradual Learning: Learn scripting by viewing and modifying the code generated by Actions.

This approach makes LiveCode Create unique, offering both speed and flexibility to meet any app logic requirements.


For further learning:

Thank you for your feedback!

Was this page helpful?